<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<link href="css/main.css" type="text/css" rel="stylesheet" />
		<title>中国人寿管理平台</title>
		<style type="text/css">
		html { overflow-x: hidden; overflow-y: hidden; }
		</style>
	</head>

	<body>
		<div class="main_top">
			<div class="logo">
			<div class="logo1">
			<img src="img/login-logo.png" />
		
			</div>
			</div>
			<div class="top_button">
				<span class="text_top">欢迎您，<i id="username"></i> </span>
				<div class="btnWrap">
				<button class="index_btn" title="首页" onclick="goIndex()">
					首页
				</button>
				<button class="switch_btn" title="切换用户" onclick="logout()">
					切换用户
				</button>
				<button class="quit_btn" title="退出" onclick="logout()">
					退出
				</button>
				</div>
			</div>
		</div>
		<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script> <!-- 
		<script type="text/javascript" src="js/cookieUtil.js"></script> -->
		<script type="text/javascript">
		
	
	
	
		
		$(document).ready(function(){
			var username = getCookieValue("username") ;
			//console.log(username);
			//decodeURIComponent(readCookie("username"));
			$("#username").text(username);
			if(new RegExp('firefox','i').test(navigator.userAgent)){
				$('.top_button').width(340); 
			}
			
		});
		
		function getCookieValue(cookie_name)
	    {
	        var allcookies = document.cookie;
	        var cookie_pos = allcookies.indexOf(cookie_name);   //索引的长度

	        // 如果找到了索引，就代表cookie存在，
	        // 反之，就说明不存在。
	        if (cookie_pos != -1)
	        {
	            // 把cookie_pos放在值的开始，只要给值加1即可。
	            cookie_pos += cookie_name.length + 1;      
	            var cookie_end = allcookies.indexOf(";", cookie_pos);

	            if (cookie_end == -1)
	            {
	                cookie_end = allcookies.length;
	            }

	            var value = allcookies.substring(cookie_pos, cookie_end);
	        }

	        return decodeURI(value);
	    }
		function logout(){
			console.log("您确定要退出吗");
			/* aa(); */
			LQConfirm("您确定要退出吗？",function(){
				console.log("您确定要退出吗");
				common_ajax("logout.do")
				window.top.location.href ="/boilerCloud/";
			});
		}
		function goIndex(){
			window.top.location.href ="goIndex.do";
		}
		
	 	var dialog="<div class=\"dialogBg\" style=\"display:none;z-index:9999999\">" +
		"<div class=\"dialog confirmDiv\" style=\"display:none;\">" +
		"<div>" +
		"<h3><i><img src=\"images/icon1.png\" width=\"100%\" /></i><span class=\"confirmMsg\">您确定要删除该消息吗？<span></h3>" +
		"<p><button class=\"sureBtn mr20\">确定</button><button class=\"cancelBtn\">取消</button></p>" +
		"</div>" +
		"</div>" +
		"</div>";
		top.$("html").append(dialog);
		//$("html").append(dialog);
		function LQConfirm(msg,fun,sureMsg,cancelMsg){
			$dialogBg = top.$(".dialogBg");
			$dialogBg.show();
			$dialogBg.find(".confirmDiv .confirmMsg").text(msg);
			$dialogBg.find(".confirmDiv").show();
			$dialogBg.find(".confirmDiv .sureBtn").unbind();
			$dialogBg.find(".confirmDiv .sureBtn").click(function(){
				$dialogBg.hide();
				$dialogBg.find(".confirmDiv").hide();
				fun();   
			});
			$dialogBg.find(".confirmDiv .cancelBtn").unbind();
			$dialogBg.find(".confirmDiv .cancelBtn").click(function(){
				$dialogBg.hide();
				$dialogBg.find(".confirmDiv").hide();
			});
			if(sureMsg){
				$dialogBg.find(".confirmDiv .sureBtn").text(sureMsg);
			}
			if(cancelMsg){
				$dialogBg.find(".confirmDiv .cancelBtn").text(cancelMsg);
			}
		} 
	</script>
	</body>
</html>
